<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
 
<div id="headerLogo">
	<span><a href='<spring:url value="/"/>' id="headerLogo" class="mainLogo"></a></span>
</div>
<div id="headerNavigation">
	<a href='<spring:url value="/#/map"/>' ><spring:message code="header.map"/></a> <a
		href="#/friends" id="header_map_btn" ><spring:message code="user.menu.friends"/></a> <a
		href="" id="header_map_btn" class="" title="Społeczność">Społeczność</a>
</div>
<div id="languageDialog" title='<spring:message code="header.chooseLanguage"/>' style="display: none">
<a href='<spring:url value="/locale?locale=pl"/>'>Polski</a>
<a href='<spring:url value="/locale?locale=en"/>'>English</a>
</div>
<ul id="headerUserOptions">
	<li class="userOption"><a id="languageButton" class="userButton"> <span
			class="label"><spring:message code="header.language"/></span>
	</a></li>
<security:authorize access="isAuthenticated()">
<security:authentication property="principal.username" var="username" scope="request"/>
	<li id="userOptionsButton" class="userOption"><a
		class="userButton headerUserSelect iconArrow"> <span class="label"><c:out value="${username }"/></span>
	</a>
		<div id="headerUserSelectOptions">
			<ul class="dropDownOptions">
				<li class="option"><a href=""><spring:message code="user.menu.profile"/></a></li>
				<li class="option"><a href=""><spring:message code="user.menu.settings"/></a></li>
				<li class="option"><a href=""><spring:message code="user.menu.friends"/></a></li>
				<li class="option"><a href=""><spring:message code="user.menu.help"/></a></li>
				<li class="option"><a href='<spring:url value="/logout"></spring:url>'><spring:message code="user.menu.logout"/></a></li>
			</ul>
		</div></li>
</security:authorize>
 
<security:authorize access="isAnonymous()">
	<li id="userLoginButton" class="userOption"><a
		class="userButton headerUserSelect iconArrow"> <span class="label"><spring:message code="header.login"/></span>
	</a>

		<div id="headerUserLogin">
			<div class="error" id="headerUserLoginError">
				<div class="message"><spring:message code="user.login.error"/></div>
			</div>

			<form id="dropdownLoginForm" class="vertical" action='<spring:url value="/j_spring_security_check"></spring:url>' method="post">
				<fieldset>
					<ul>
						<li><label for="header_login_username" class="label">
							<spring:message code="label.login"/>:
						</label>
							<div class="inputWrapper">
								<div class="cap">
									<input id="header_login_username" type="text" name="j_username"
										value="">
								</div>
							</div>
							<div class="clear"></div></li>
						<li><label for="header_login_password" class="label"><spring:message code="label.password"/>:</label>
							<div class="inputWrapper">
								<div class="cap">
									<input id="header_login_password" type="password"
										name="j_password" value="">
								</div>
							</div>
							<div class="clear"></div></li>
						<li>
							<button class="btn" type="submit">
								<div>
									<span><spring:message code="user.login.login"/></span>
								</div>
							</button> 
							<a class="forget"><spring:message code="user.login.remind"/></a>
							<div class="clear"></div>
						</li>
					</ul>
					<div class="clear"></div>
				</fieldset>
			</form>

			<div class="loginLinks">
				<div class="capsuleBottom">
					<a href="#/register" class="signup"><spring:message code="user.login.register"/></a>
				</div>
				<div class="clear"></div>
			</div>

		</div></li>
	<li class="userOption"><a href="#/register" class="userButton"> <span
			class="label"><spring:message code="header.createAccount"/></span>
	</a></li>
	</security:authorize>
</ul>
